import Vue from 'vue';
// import { canI } from '@/utils/api';
import { i18n } from '@/boot/i18n';
import store from '../../../store';
// import portalStore from '../../portal/store';

export default [
  {
    path: '/admin',
    component: () => import('../view/Layout.vue'),
    redirect: '/admin/home',
    beforeEnter: (from, to, next) => {
      store.commit('app/SET_LOCALE', 'zh-cn');
      i18n.locale = 'zh-cn';

      return next();
    },
    props: () => ({
      GetData: () => Vue.prototype.nothingRequest().then((d) => {
        const data = (d && d.data) || {};

        return data;
      }),
    }),
    children: [
      {
        path: 'home',
        component: () => import('../view/home.vue'),
        meta: [
          {
            title: '首页',
          },
        ],
      },
      {
        path: 'uc/resetpwd',
        ref: 'uc>resetpwd',
        meta: [
          {
            title: '用户中心',
          },
          {
            title: '修改密码',
          },
        ],
      },
      {
        path: 'uc/changephone',
        ref: 'uc>resetphone',
        meta: [
          {
            title: '用户中心',
          },
          {
            title: '修改手机号',
          },
        ],
      },
      {
        path: 'uc/info',
        ref: 'uc>info',
        meta: [
          {
            title: '用户中心',
          },
          {
            title: '账号信息',
          },
        ],
      },
    ],
  },
];
